package cn.ffcs.common.web;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;

import cn.ffcs.base.model.BaseEntity;
import cn.ffcs.base.web.BaseAction;
import cn.ffcs.product.model.ProductReference;
import cn.ffcs.product.service.IProductReferenceService;
import cn.ffcs.security.model.UserResource;
import cn.ffcs.security.service.IUserService;
import cn.ffcs.security.web.UserContext;
import cn.ffcs.util.context.Constant;

/**
 * 业务action层<br/>
 * <table>
 * <tr>
 * <td>负责人/principal:</td>
 * <td colspan="2">liuzhh</td>
 * <tr>
 * <td>修改记录/revision:</td>
 * <td colspan="2"></td>
 * </tr>
 * <tr>
 * <td>日期:</td>
 * <td>修改人:</td>
 * <td>修改说明:</td>
 * </tr>
 * <tr>
 * <td></td>
 * <td></td>
 * <td></td>
 * </tr>
 * </table>
 * @author liuzhh
 * @version $Id$
 */
public class PageTopAction<B extends BaseEntity> extends BaseAction<BaseEntity>
{
    /** 用户服务**/
    private IUserService userService;
   
    private UserContext userContext;
    /** 菜单资源列表 **/
    private List<UserResource> menus;
    /** 返回OA的链接 **/
    private String link;
    
    private String oaFlag;

    public String getData(){
        
        userContext=(UserContext)getAppContextObject(Constant.LOGIN_USER_CONTEXT_);
        menus=userContext.getMenus();
        String flag="FJ,FZ,XM,QZ,NP,PT,ZZ,SM,ND,LY";
        String userId=userContext.getCurrUser().getUserID();
        String tmp=userId.substring(0,2);
        link="http://www.fjtelecom.com/fj/dx_home.nsf";
        if(tmp!=null&&tmp.length()==2&&flag.indexOf(tmp)>-1){
            link="http://www.fjtelecom.com/"+tmp+"/dx_home.nsf";
        }
        return SUCCESS;
    }

    /**
     * 返回用户服务
     * @return the userService
     */
    public IUserService getUserService()
    {
        return userService;
    }

    /**
     * 设置用户服务
     * @param userService the userService to set
     */
    public void setUserService(IUserService userService)
    {
        this.userService = userService;
    }

    /**
     * @return the userContext
     */
    public UserContext getUserContext()
    {
        return userContext;
    }

    /**
     * @param userContext the userContext to set
     */
    public void setUserContext(UserContext userContext)
    {
        this.userContext = userContext;
    }

    /**
     * @return the menus
     */
    public List<UserResource> getMenus()
    {
        return menus;
    }

    /**
     * @param menus the menus to set
     */
    public void setMenus(List<UserResource> menus)
    {
        this.menus = menus;
    }

    public String getLink()
    {
        return link;
    }

    public void setLink(String link)
    {
        this.link = link;
    }

    public String getOaFlag()
    {
        return oaFlag;
    }

    public void setOaFlag(String oaFlag)
    {
        this.oaFlag = oaFlag;
    }
    
  
}
